class Count extends React.Component{
	// 构造器
	constructor(props) {
		console.log("Count-constructor")
		super(props);
		this.state={count:0};
	}
	componentWillMount(){
		console.log("Count-componentWillMount")
	}
	componentDidMount(){
		console.log("Count-componentDidMount")
	}
	componentWillUnmount(){
		console.log("Count-componentWillUnmount")
	}
	shouldComponentUpdate(a){
		console.log(a)
		console.log("Count-shouldComponentUpdate")
		return false;
	}
	componentWillUpdate(){
		console.log("Count-componentWillUpdate")
	}
	componentDidUpdate(){
		console.log("Count-componentDidUpdate")
	}
	unmount=()=>{
		ReactDOM.unmountComponentAtNode(document.getElementById('test'))
	}
	add=()=>{
		let {count}=this.state
		this.setState({count:count+1});
	}
	forceUpdates=()=>{
		this.forceUpdate()
	}
  render(){
		console.log('Count-render')
  	return (
  		<div>
				<h2>当前求和为{this.state.count}</h2>
				<button onClick={this.add}>点我</button><br/>
				<button onClick={this.unmount}>卸载</button><br/>
				<button onClick={this.forceUpdates}>强制更新</button><br/>
			</div>
		)
	}
}
ReactDOM.render(<Count/>,document.getElementById('test'));
